﻿using System;
using System.ComponentModel.DataAnnotations;
using Util.Domains.Trees;

namespace IterationLife.Educations.Queries {
    /// <summary>
    /// 课程大纲查询实体
    /// </summary>
    public class SyllabusQuery : TreeQueryBase {
        /// <summary>
        /// 课程大纲编号
        /// </summary>
        [Display(Name="课程大纲编号")]
        public Guid? SyllabusId { get; set; }
        
        private string _name = string.Empty;
        /// <summary>
        /// 名称
        /// </summary>
        [Display(Name="名称")]
        public string Name {
            get { return _name == null ? string.Empty : _name.Trim(); }
            set{ _name=value;}
        }
        /// <summary>
        /// 教材编号
        /// </summary>
        [Display(Name="教材编号")]
        public Guid? TextBookId { get; set; }
        /// <summary>
        /// 内容资源编号
        /// </summary>
        [Display(Name="内容资源编号")]
        public Guid? ContentResourceId { get; set; }
        /// <summary>
        /// 起始创建时间
        /// </summary>
        [Display( Name = "起始创建时间" )]
        public DateTime? BeginCreationTime { get; set; }
        /// <summary>
        /// 结束创建时间
        /// </summary>
        [Display( Name = "结束创建时间" )]
        public DateTime? EndCreationTime { get; set; }        
        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name="创建人")]
        public Guid? CreatorId { get; set; }
        /// <summary>
        /// 起始最后修改时间
        /// </summary>
        [Display( Name = "起始最后修改时间" )]
        public DateTime? BeginLastModificationTime { get; set; }
        /// <summary>
        /// 结束最后修改时间
        /// </summary>
        [Display( Name = "结束最后修改时间" )]
        public DateTime? EndLastModificationTime { get; set; }        
        /// <summary>
        /// 最后修改人
        /// </summary>
        [Display(Name="最后修改人")]
        public Guid? LastModifierId { get; set; }
        
        /// <summary>
        /// 添加描述
        /// </summary>
        protected override void AddDescriptions() {
            base.AddDescriptions();
            AddDescription( "课程大纲编号", SyllabusId );
            AddDescription( "名称", Name );
            AddDescription( "教材编号", TextBookId );
            AddDescription( "内容资源编号", ContentResourceId );
            AddDescription( "起始创建时间", BeginCreationTime );
            AddDescription( "结束创建时间", EndCreationTime );
            AddDescription( "创建人", CreatorId );
            AddDescription( "起始最后修改时间", BeginLastModificationTime );
            AddDescription( "结束最后修改时间", EndLastModificationTime );
            AddDescription( "最后修改人", LastModifierId );
        }
        
        /// <summary>
        /// 检查查询参数是否全部为空
        /// </summary>
        protected override void CheckEmpty() {
            base.CheckEmpty();
            AddValue( SyllabusId );
            AddValue( Name );
            AddValue( TextBookId );
            AddValue( ContentResourceId );
            AddValue( BeginCreationTime );
            AddValue( EndCreationTime );
            AddValue( CreatorId );
            AddValue( BeginLastModificationTime );
            AddValue( EndLastModificationTime );
            AddValue( LastModifierId );
        }
    }
}
